﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using YF.NLOG;

namespace ThermoGroupSample
{
    public static class StaticMethods
    {
        public static void AppendTextColorful(this RichTextBox rtBox, string text, Color color, bool addNewLine = true)
        {
            try
            {
                if (addNewLine)
                {
                    text += Environment.NewLine;
                }
                rtBox.SelectionStart = rtBox.TextLength;
                rtBox.SelectionLength = 0;
                rtBox.SelectionColor = color;
                rtBox.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "==>" + text);
                rtBox.SelectionColor = rtBox.ForeColor;
            }
            catch (Exception ex)
            {
                LoggerHelper._log.Error("【页面更新方法异常】", ex);
            }

        }
    }
}
